from rest_framework import serializers

from six_it.models import Recruit, Enterprise

class RecruitsSerializer(serializers.ModelSerializer):

    class Meta:
        model = Recruit
        fields = ['id']


class EnterpriseSerializer(serializers.ModelSerializer):

    recruits = RecruitsSerializer()

    class Meta:
        model = Enterprise
        fields = ['id', 'name', 'labels', 'logo', 'recruits', 'summary']


class RecommendedSerializer(serializers.ModelSerializer):
    enterprise = EnterpriseSerializer()

    class Meta:
        model = Recruit

        fields = ['id', 'jobname', 'salary', 'condition', 'education', 'type','city',
                  'createtime', 'enterprise', 'labels']